#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
	int n, a, b;
	string s;
	cin >> n;

	for (int i = 1; i <= n; i++) {
		cin >> s >> a >> b;
		cout << ((15 > a || a > 20) || (50 > b || b > 70) ? s + "\n" : "");
	}
	return 0;
}
